#ifndef Missile_h
#define Missile_h

#include "Object.h"

class Missile : public Object
{
public:
	Missile(int p_power, Vector2 p_position, Vector2 p_velocity)
	: Object(MISSILE, color(255,255,255,255), 100, 1, p_position, p_velocity)
	{
		m_power = p_power;
		m_health = GC_MISSILE_HEALTH;

		m_explode_charges = 1;
	}
	~Missile();

	int getPower() const
	{
		return m_power;
	}
	Vector2 getDirection() const
	{
		return m_direction;
	}

	virtual void tick()
	{
		Object::tick();
		if (getAge() > GC_MISSILE_LIFE_TIME)
			kill();
	}
	virtual void updatePosition(double p_dt)
	{
		Object::updatePosition(p_dt);
		
		//update direction
		double l = m_velocity.getLength();
		double x = m_velocity.getX();
		double y = m_velocity.getY();
		m_direction = Vector2( x/l, y/l);
	}
protected:
	int m_power;	
	Vector2 m_direction;		
};

#endif //Missile_h
